<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <title>redirect</title>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../statics/js/global.js">
    </script>
</head>

<body>
    <span id="message"></span>
</body>
<script>
    var bizLinkId64 = getUrlParam("linkId");

    if (isEmptyOrNull(bizLinkId64)) {
        $("#message").html("Parameter error!");
    } else {

        var param = {
            bizLinkId64: bizLinkId64
        };
        console.log("Param:" + JSON.stringify(param));

        $.ajax({
            type: "post",
            url: baseUrlCon.baseAPI + 'shortLink/redirect',
            contentType: 'application/json',
            data: JSON.stringify(param),
            dataType: "json",
            success: function(data) {
                if (data.success) {
                    window.location.href = data.data;
                } else {
                    alert("Parameter error!");
                    window.location.href = "https://www.xfunction.cn/shortLink";
                }
            },
            error: function() {
                alert("Parameter error!");
                window.location.href = "https://www.xfunction.cn/shortLink";
            }
        });
    }
</script>

</html>